# 多无人机 种 巨大南瓜(32x32) 首次尝试
# 多任务 基础教学
# 25M/min

from utils import *
clear()
l = 32 # 地图已达到最大

def task(t):
    cx,ismain = t
    map = []
    goto(l,cx,0)
    for y in range(l):
        plant(Entities.Pumpkin)
        pourwater(.25)
        move(North)
        map.append(y)
    while 1:
        growing_map = []
        for y in map:
            goto(l,cx,y)
            if not can_harvest():
                plant(Entities.Pumpkin)
                pourwater(.75)
                map.append(y)
        map = growing_map
        if len(map) == 0:
            if not ismain:
                return False
            while 1:
                if num_drones() == 1:
                    harvest()
                    return True
                        
        

# 先把地耕了
till_all()

while 1:
    for i in range(1,l):
        spawn_drone(create_task(task,(i,None)))
    task((0,True))
        